
cmake_minimum_required(VERSION 3.0)

project(socket_test_module)

add_definitions(-g -Wall -Wshadow)

include_directories(./)
include_directories(./../)
include_directories(./../../)

set(CMAKE_EXPORT_COMPILE_COMMANDS ON)


set(test_socket_address_src_list ./test_socket_address.cpp
  ./../socket_address.cpp)

#add_executable(TEST_SOCKET_ADDRESS ${test_socket_address_src_list})


set(test_socket_channel_src_list ./test_socket_channel.cpp
  ./../socket_address.cpp
  ./../socket_description.cpp
  ./../socket_channel.cpp
  ./../../loop_module/loop.cpp
  ./../../io_reuse_module/io_reuse_module.cpp
  ./../../io_reuse_module/io_epoll.cpp
  ./../../io_reuse_module/io_poll.cpp
  ./../../description_module/description_util.cpp)

#add_executable(TEST_SOCKET_CHANNEL ${test_socket_channel_src_list})

set(test_socket_connection_src_list ./test_socket_connection.cpp
  ./../socket_address.cpp
  ./../socket_description.cpp
  ./../socket_channel.cpp
  ./../tcp_socket_connection.cpp
  ./../../loop_module/loop.cpp
  ./../../io_reuse_module/io_reuse_module.cpp
  ./../../io_reuse_module/io_epoll.cpp
  ./../../io_reuse_module/io_poll.cpp
  ./../../write_read_module/buffer.cpp
  ./../../description_module/description_util.cpp)

#add_executable(TEST_SOCKET_CONNECTION ${test_socket_connection_src_list})


set(test_socket_server_src_list ./test_socket_server.cpp
  ./../socket_address.cpp
  ./../socket_description.cpp
  ./../socket_channel.cpp
  ./../socket_server.cpp
  ./../socket_server_connection.cpp
  ./../../loop_module/loop.cpp
  ./../../io_reuse_module/io_reuse_module.cpp
  ./../../io_reuse_module/io_epoll.cpp
  ./../../io_reuse_module/io_poll.cpp
  ./../../write_read_module/buffer.cpp
  ./../../description_module/description_util.cpp)


#add_executable(TEST_SOCKET_SERVER ${test_socket_server_src_list})

set(test_tls_socket_connection_src_list ./test_tls_socket_connection.cpp
  ./../socket_description.cpp
  ./../tls_socket_operate.cpp
  ./../socket_channel.cpp
  ./../socket_address.cpp
  ./../tls_socket_connection.cpp
  ./../../loop_module/loop.cpp
  ./../../io_reuse_module/io_reuse_module.cpp
  ./../../io_reuse_module/io_epoll.cpp
  ./../../io_reuse_module/io_poll.cpp
  ./../../write_read_module/buffer.cpp
  ./../../description_module/description_util.cpp)

#add_executable(TEST_TLS_SOCKET_CONNECTION ${test_tls_socket_connection_src_list})

set(test_socket_connection_of_tcp_src_list
        ./test_socket_connection_of_tcp.cpp
        ./../tcp_socket_connection.cpp
        ./../socket_channel.cpp
        ./../socket_address.cpp
        ./../socket_description.cpp
        ./../socket_util.cpp
        ./../../loop_module/loop.cpp
        ./../../io_reuse_module/io_reuse_module.cpp
        ./../../io_reuse_module/io_epoll.cpp
        ./../../io_reuse_module/io_poll.cpp
        ./../../description_module/description_util.cpp
        ./../../write_read_module/buffer.cpp)

add_executable(test_socket_connection_of_tcp ${test_socket_connection_of_tcp_src_list})

set(test_socket_connection_of_tls_src_list
        ./test_socket_connection_of_tls.cpp
        ./../tls_socket_connection.cpp
        ./../tls_socket_operate.cpp
        ./../socket_channel.cpp
        ./../socket_address.cpp
        ./../socket_description.cpp
        ./../../loop_module/loop.cpp
        ./../../io_reuse_module/io_reuse_module.cpp
        ./../../io_reuse_module/io_epoll.cpp
        ./../../io_reuse_module/io_poll.cpp
        ./../../description_module/description_util.cpp
        ./../../write_read_module/buffer.cpp)

add_executable(test_socket_connection_of_tls ${test_socket_connection_of_tls_src_list})

set(test_socket_connection_of_udp_src_list
        ./test_socket_connection_of_udp.cpp
        ./../udp_socket_connection.cpp
        ./../socket_channel.cpp
        ./../socket_description.cpp
        ./../socket_address.cpp
        ./../../loop_module/loop.cpp
        ./../../io_reuse_module/io_poll.cpp
        ./../../io_reuse_module/io_epoll.cpp
        ./../../io_reuse_module/io_reuse_module.cpp
        ./../../description_module/description_util.cpp
        ./../../string_util/string_util.cpp
        ./../../write_read_module/buffer.cpp)

add_executable(test_socket_connection_of_udp ${test_socket_connection_of_udp_src_list})

set(test_socket_server_of_tcp_src_list
        ./test_socket_server_of_tcp.cpp
        ./../tcp_socket_server_connection.cpp
        ./../socket_address.cpp
        ./../socket_channel.cpp
        ./../socket_description.cpp
        ./../../loop_module/loop.cpp
        ./../../io_reuse_module/io_reuse_module.cpp
        ./../../io_reuse_module/io_epoll.cpp
        ./../../io_reuse_module/io_poll.cpp
        ./../../description_module/description_util.cpp
        ./../../string_util/string_util.cpp
        ./../../write_read_module/buffer.cpp)

add_executable(test_socket_server_of_tcp ${test_socket_server_of_tcp_src_list})

set(test_socket_server_of_tls_src_list
        ./test_socket_server_of_tls.cpp
        ./../tls_socket_server_connection.cpp
        ./../socket_address.cpp
        ./../socket_channel.cpp
        ./../socket_description.cpp
        ./../tls_socket_operate.cpp
        ./../../loop_module/loop.cpp
        ./../../io_reuse_module/io_reuse_module.cpp
        ./../../io_reuse_module/io_epoll.cpp
        ./../../io_reuse_module/io_poll.cpp
        ./../../description_module/description_util.cpp
        ./../../string_util/string_util.cpp
        ./../../write_read_module/buffer.cpp)

add_executable(test_socket_server_of_tls ${test_socket_server_of_tls_src_list})

set(open_libs gtest_main gtest)
set(openssl_libs ssl crypto pthread)

target_link_libraries(test_socket_connection_of_tcp ${open_libs})
target_link_libraries(test_socket_connection_of_tcp ${openssl_libs})

target_link_libraries(test_socket_connection_of_tls ${open_libs})
target_link_libraries(test_socket_connection_of_tls ${openssl_libs})

target_link_libraries(test_socket_connection_of_udp ${open_libs})
target_link_libraries(test_socket_connection_of_udp ${openssl_libs})

target_link_libraries(test_socket_server_of_tcp ${open_libs})
target_link_libraries(test_socket_server_of_tcp ${openssl_libs})

target_link_libraries(test_socket_server_of_tls ${open_libs})
target_link_libraries(test_socket_server_of_tls ${openssl_libs})

#target_link_libraries(TEST_SOCKET_ADDRESS ${open_libs})
#target_link_libraries(TEST_SOCKET_CHANNEL ${open_libs})
#target_link_libraries(TEST_SOCKET_CONNECTION ${open_libs})
#target_link_libraries(TEST_SOCKET_SERVER  ${open_libs})
#target_link_libraries(TEST_TLS_SOCKET_CONNECTION ${open_libs})
#target_link_libraries(TEST_TLS_SOCKET_CONNECTION ${openssl_libs})




